﻿#region using statements

using System;

using AeonOfStrife.Objects.Units;

using AeonOfStrifeDatatypes.Combat;

using Microsoft.Xna.Framework;

#endregion

namespace AeonOfStrife.Combat
{
	public delegate void UnitAttackEvent(IAttacker p_attacker, DamageValues p_damage);

	public delegate void UnitDeathEvent(IAttackable p_attackee);

	public interface IAttacker
	{
		///<summary>
		///	get the thing IAttackable this attacker is targetting
		///</summary>
		IAttackable Target { get; }

		///<summary>
		///	event for notifying the target it has been attacked
		///</summary>
		event UnitAttackEvent ThrowAttackEvent;

		///<summary>
		///	method invoked when the target dies
		///</summary>
		///<param name = "p_attackee">the thing dying</param>
		void OnTargetDeath(IAttackable p_attackee);

		///<summary>
		///	get a target to begin attacking
		///</summary>
		void AcquireTarget();

		///<summary>
		///	execute a single attack at the target
		///</summary>
		void AttackTarget(DamageValues p_damage);
	}

	public interface IAttackable
	{
		///<summary>
		///	get the hp of this IAttackable
		///</summary>
		int Hp { get; }

		/// <summary>
		/// get the location of this IAttackable
		/// </summary>
		Vector2 Position { get; }

		///<summary>
		///	get the defenses
		///</summary>
		DamageValues Defense { get; }

		///<summary>
		///	get or set the priority to the enemy
		///</summary>
		EnemyPriority EnemyPriority { get; set; }

		///<summary>
		///	event for notifying attackers that this attackable has died
		///</summary>
		event UnitDeathEvent ThrowDeathEvent;

		///<summary>
		///	this IAttackable has been attacked, take appropriate actions
		///</summary>
		///<param name = "p_attacker">the attacker</param>
		///<param name = "p_damage">the damage</param>
		void OnAttacked(IAttacker p_attacker, DamageValues p_damage);

		///<summary>
		///	an IAttacker has targetted this unit, subscribe to death event
		///</summary>
		///<param name = "p_attacker">the attacker</param>
		void RegisterAttacker(IAttacker p_attacker);

		///<summary>
		///	an IAttacker has stopped targetting this unit, unsubscribe to death event
		///</summary>
		///<param name = "p_attacker">the attacker</param>
		void UnregisterAttacker(IAttacker p_attacker);
	}
}